package com.youi.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youi.shop.pojo.entity.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 购物车表 Mapper 接口
 * </p>
 *
 * @author xxf
 * @since 2020-11-09
 */
@Mapper
@Repository
public interface CartMapper extends BaseMapper<Cart> {

    /**
     * 根据商品id和会员id查询购物车是否已经存在
     * @param productId
     * @param memberId
     * @return
     */
    Cart selectByProductIdAndMemberId(@Param("productId") Long productId, @Param("memberId") Long memberId);

    /**
     * 根据会员id查询所有购物车信息
     * @param memberId
     * @return
     */
    List<Cart> selectByMemberId(@Param("memberId") Long memberId);

    /**
     * 根据购物车id查询
     * @param cartId
     * @return
     */
    Cart selectByCartId(@Param("cartId")Long cartId);
}
